﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VitCode.Castle.Entities
{
    public class Role : BaseEntity
    {
        protected string m_Alias;
        public virtual string Alias
        {
            get { return m_Alias; }
            set { m_Alias = value; }
        }

        protected string m_Name;
        public virtual string Name
        {
            get { return m_Name; }
            set { m_Name = value; }
        }

        /// <summary>
        /// 重写Equals方法
        /// </summary>
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(obj, this))
                return true;
            if (obj == null)
                return false;
            var sObj = obj as Role;
            return sObj != null && (sObj.Id == m_Id || (sObj.Alias == m_Alias));
        }

        /// <summary>
        /// 重写GetHashCode方法
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 33;
            hash = 27 * hash * m_Id.GetHashCode();
            return hash;
        }
    }
}
